/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-12 07:24:20
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-20 14:35:53
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/components/animation_text.dart';
import '../../../../constants.dart';

class ItemCard extends StatelessWidget {
  const ItemCard(
      {Key key,
      this.title,
      this.upContent,
      this.downContent,
      this.color = Colors.white,
      this.upCount = 0,
      this.downCount = 0})
      : super(key: key);
  final String title;
  final String upContent;
  final int upCount;
  final int downCount;

  final String downContent;
  final Color color;

  @override
  Widget build(BuildContext context) => Expanded(
        child: Container(
          height: 60,
          padding: EdgeInsets.only(top: 10, left: 10, right: 15, bottom: 10),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(defaultRadius),
            color: color,
          ),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    title,
                    style: TextStyle(fontSize: 14),
                  ),
                  Container(
                    margin: EdgeInsets.only(top: 5),
                    width: 20,
                    height: 3,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(15),
                      color: Colors.black,
                    ),
                  ),
                ],
              ),
              VerticalDivider(
                width: 30,
                thickness: 1,
                color: Color(0xffDEDEDE),
                indent: 5,
                endIndent: 5,
              ),
              Expanded(
                child: Column(
                  mainAxisSize: MainAxisSize.max,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            upContent,
                            style: TextStyle(
                              fontSize: 11,
                              color: Color(0xff9C9C9C),
                            ),
                          ),
                          AnimText(
                            number: upCount,
                            style: TextStyle(
                              fontSize: 11,
                              color: Color(0xff9C9C9C),
                            ),
                          ),
                        ]),
                    SizedBox(height: 6),
                    Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            downContent,
                            style: TextStyle(
                              fontSize: 11,
                              color: Color(0xff9C9C9C),
                            ),
                          ),
                          AnimText(
                            number: downCount,
                            style: TextStyle(
                              fontSize: 11,
                              color: Color(0xff9C9C9C),
                            ),
                          ),
                        ]),
                  ],
                ),
              ),
            ],
          ),
        ),
      );
}
